package com.software.graduationproject.modules.sys.entity;

import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.v2coding.mybatis.model.BaseModel;
import com.v2coding.validate.CreateGroup;
import com.v2coding.validate.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("sys_menu")
@ApiModel(value = "SysMenu", description = "菜单")
public class SysMenu extends BaseModel<SysMenu> {

    @TableField("up_id")
    @ExcelProperty(value = "上级ID")
    @ApiModelProperty(value = "上级ID")
    @NotNull(groups = {CreateGroup.class, UpdateGroup.class}, message = "上级ID不能为空")
    private Long upId;

    @TableField("name")
    @ExcelProperty(value = "菜单名称")
    @ApiModelProperty(value = "菜单名称")
    @NotEmpty(groups = {CreateGroup.class, UpdateGroup.class}, message = "菜单名称不能为空")
    private String name;

    @TableField("url")
    @ExcelProperty(value = "菜单地址")
    @ApiModelProperty(value = "菜单地址")
    private String url;

    @TableField("path")
    @ExcelProperty(value = "文件路径")
    @ApiModelProperty(value = "文件路径")
    private String path;

    @TableField("type")
    @ExcelProperty(value = "菜单类型(1 目录 2 菜单 3 操作)")
    @ApiModelProperty(value = "菜单类型(1 目录 2 菜单 3 操作)")
    @NotNull(groups = {CreateGroup.class, UpdateGroup.class}, message = "菜单类型(1 目录 2 菜单 3 操作)不能为空")
    private Integer type;

    @TableField("auth")
    @ExcelProperty(value = "权限标识")
    @ApiModelProperty(value = "权限标识")
    private String auth;

    @TableField("icon")
    @ExcelProperty(value = "图标class样式")
    @ApiModelProperty(value = "图标class样式")
    private String icon;

    @TableField("sort")
    @ExcelProperty(value = "排序序号")
    @ApiModelProperty(value = "排序序号")
    private Integer sort;

    @TableField("cover_url")
    @ExcelProperty(value = "封面图片")
    @ApiModelProperty(value = "封面图片")
    private String coverUrl;

    @TableField("show_level2_menu")
    @ApiModelProperty(value = "是否展示二级菜单")
    private Integer showLevel2Menu;

    @TableField("tenant_id")
    @ExcelProperty(value = "租户ID")
    @ApiModelProperty(value = "租户ID")
    private Long tenantId;

}
